package com.zhiche.lisa.config;

import com.zhiche.lisa.core.utils.SnowFlakeId;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by qichao on 2018/7/11.
 */
@Configuration
@ConfigurationProperties(prefix = "snowflake")
public class SnowFlakeIdConfig {

    private long datacenterId;

    private long machineId;

    @Bean
    public SnowFlakeId snowFlakeId(){
        return new SnowFlakeId(datacenterId,machineId);
    }
}
